﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <script type="text/javascript" src="xml.js"></script>
</head>
<body>
    <h1>请输入xml字符串：</h1>
    <textarea id="xmlArea" rows="6" cols="200"><p>123</p></textarea>
    <input value="解析xml文档 " onclick="parser()" />
    <script type="text/javascript">
        function parser() {
            var xml = document.getElementById("xmlArea").value;
            try {
                var xmlDom = parseXML(xml);
            } catch (e) {
                alert(e.message);
                return;
            }
            alert(xmlDom.documentElement.tagName);
        }
    </script>
</body>
</html>
